import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';

import 'rxjs/add/operator/toPromise';


@Injectable()


export class EquipmentService {
    constructor(private http: Http) { }

    getPramsRange() {
        return this.http.get('../../../assets/mock-data/prams-range.json')
            .toPromise()
            .then(res => res.json().data)
            .then(data => { return data; });
    }

    getdevicesList(i:number) {
        return this.http.get('../../../assets/mock-data/device-list.json')
            .toPromise()
            .then(res => {
                if (i === 1) {
                    return res.json().dataWithoutCustomer;
                } else {
                    return res.json().dataWithCustomer;
                }
            })
    }

    getProductSetting() {
        return this.http.get('../../../assets/mock-data/product-setting.json')
            .toPromise()
            .then(res => res.json().data)
            .then(data => { return data; });
    }
}